package com.wlp.pengpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wlp.pengpicturebackend.model.dto.picture.PictureQueryRequest;
import com.wlp.pengpicturebackend.model.dto.picture.PictureReviewRequest;
import com.wlp.pengpicturebackend.model.dto.picture.PictureUploadByBatchRequest;
import com.wlp.pengpicturebackend.model.dto.picture.PictureUploadRequest;
import com.wlp.pengpicturebackend.model.entity.Picture;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wlp.pengpicturebackend.model.entity.User;
import com.wlp.pengpicturebackend.model.vo.PictureVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * @author wlp
 * @description 针对表【picture(图片)】的数据库操作Service
 * @createDate 2025-01-09 16:49:03
 */
public interface PictureService extends IService<Picture> {

    /**
     * 图片上传
     *
     * @param inputSource:
     * @param pictureUploadRequest:
     * @param loginUser:
     * @Author: wlp
     * @Date: 2025/1/10 10:15
     * @return: com.wlp.pengpicturebackend.model.vo.PictureVO
     **/
    PictureVO uploadPicture(Object inputSource,
                            PictureUploadRequest pictureUploadRequest,
                            User loginUser);

    /**
     * 查询请求转为 QueryWrapper 对象
     * @param pictureQueryRequest:
     * @Author: wlp
     * @Date: 2025/1/10 10:15
     * @return: com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<com.wlp.pengpicturebackend.model.entity.Picture>
     **/
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

    /**
     * 获取图片封装单条
     * @param picture:
     * @param request:
     * @Author: wlp
     * @Date: 2025/1/10 10:15
     * @return: com.wlp.pengpicturebackend.model.vo.PictureVO
     **/
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    /**
     * 获取图片封装单条
     * @param picturePage:
     * @param request:
     * @Author: wlp
     * @Date: 2025/1/10 10:16
     * @return: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.wlp.pengpicturebackend.model.vo.PictureVO>
     **/
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);

    /**
     * 图片数据校验
     * @param picture:
     * @Author: wlp
     * @Date: 2025/1/10 10:16
     * @return: void
     **/
    void validPicture(Picture picture);

    /**
     * 图片审核
     *
     * @param pictureReviewRequest
     * @param loginUser
     */
    void doPictureReview(PictureReviewRequest pictureReviewRequest, User loginUser);

    /**
     * 填充审核参数
     *
     * @param picture
     * @param loginUser
     */
    void fillReviewParams(Picture picture, User loginUser);

    /**
     * 批量抓取和创建图片
     * @Author: wlp
     * @Date: 2025/1/14 13:51
     * @param pictureUploadByBatchRequest:
     * @param loginUser:
     * @return: java.lang.Integer
     **/
    Integer uploadPictureByBatch(
            PictureUploadByBatchRequest pictureUploadByBatchRequest,
            User loginUser
    );

}
